home *** CD-ROM | disk | FTP | other *** search
/ ShareWare OnLine 2 / ShareWare OnLine Volume 2 (CMS Software)(1993).iso / cad / mar93cad.zip / TIP853.LSP < prev    next >
Lisp/Scheme  |  1993-02-13  |  2KB  |  37 lines

  1. ; TIP853: DCHAMFER.LSP (c)1993, Andrew C. Clarey
  2.  
  3. ;This command will dimension a "Chamfer", by a note if the chamfer angle
  4. ;is 45 degree's, or by a horizontal and vertical dimension if the angle is
  5. ;other than 45 degree's.
  6.  
  7. (defun C:DCHAMFER(/ CL CHAM DL PT1 PT2 ANG ANG1 DIST PT3 PT4 DIST1 T1 H1 V1)
  8.    (setvar "CMDECHO" 0)
  9.    (setq CL(getvar "CLAYER")
  10.          CHAM(entget(car(entsel "\nSelect Chamfer to Dimension: ")))
  11.          DL(getstring "\nEnter Layer for Chamfer Dimension: ")
  12.          PT1(cdr(assoc 10 CHAM))
  13.          PT2(cdr(assoc 11 CHAM))
  14.          ANG(angle PT1 PT2)
  15.          ANG1(angtos ANG 0 0)
  16.          DIST(distance PT1 PT2))
  17.    (cond 
  18.      ((or(= ANG1 "45")(= ANG1 "135")(= ANG1 "225")(= ANG1 "315"))
  19.          (setq PT3(polar PT1 ANG (/ DIST 2.0))
  20.                PT4(getpoint "\nChoose Note Location: ")
  21.                DIST1(rtos(* DIST(abs(cos ANG))) 2 2)
  22.                T1(strcat "Chamfer" " 45"  "%%d" " * " DIST1))
  23.          (command "layer" "s" DL "" "dim"  "leader" PT3 PT4 "" T1 "" "" nil)
  24.      )
  25.      ((or(and(> ANG1 "0")(< ANG1 "45"))
  26.          (and(> ANG1 "45")(< ANG1 "135"))
  27.          (and(> ANG1 "135")(< ANG1 "225"))
  28.          (and(> ANG1 "225")(< ANG1 "315"))
  29.          (and(> ANG1 "315")(< ANG1 "360")))    
  30.          (setq H1(getpoint "\nHorizontal Dimension Line Location: ")
  31.                V1(getpoint "\nVertical Dimension Line Location: "))
  32.          (command "layer" "s" DL "" "dim" "horizontal" PT1 PT2 H1 "" "vertical" PT1 PT2 V1 "" nil)
  33.      )         
  34.    )
  35.    (command "layer" "s" CL "")
  36. )
  37.